package com.eshop.base.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 第三方登录绑定表
 * </p>
 *
 * @author raohj
 * @since 2025-05-13
 */
@Getter
@Setter
@ToString
@Accessors(chain = true)
@TableName("user_oauth")
@ApiModel(value = "UserOauth对象", description = "第三方登录绑定表")
public class UserOauth implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "oauth_id", type = IdType.AUTO)
    private Long oauthId;

    /**
     * 关联user.user_id
     */
    @TableField("user_id")
    @ApiModelProperty("关联user.user_id")
    private Long userId;

    /**
     * 平台标识（如wechat、alipay）
     */
    @TableField("platform")
    @ApiModelProperty("平台标识（如wechat、alipay）")
    private String platform;

    /**
     * 第三方用户唯一ID
     */
    @TableField("open_id")
    @ApiModelProperty("第三方用户唯一ID")
    private String openId;

    /**
     * 跨应用ID（如微信UnionID）
     */
    @TableField("union_id")
    @ApiModelProperty("跨应用ID（如微信UnionID）")
    private String unionId;

    /**
     * 授权令牌
     */
    @ApiModelProperty("授权令牌")
    @TableField("access_token")
    private String accessToken;

    @TableField("refresh_token")
    private String refreshToken;

    /**
     * 令牌过期时间
     */
    @TableField("expires_at")
    @ApiModelProperty("令牌过期时间")
    private LocalDateTime expiresAt;

    @TableField("created_at")
    private LocalDateTime createdAt;

    @TableField("updated_at")
    private LocalDateTime updatedAt;
}
